<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<% 
	String context = request.getContextPath(); 
%>
<html>
<head>
	<title>流程参数</title>
	<link rel="stylesheet" href="<%=context %>/Source/lib/layui/css/layui.css">
</head>
<body style="margin: 0;">
<%-- 表单 --%>
<div class="layui-form" id="form1"  style="margin-right: 50px;margin-top: 30px">
	<input id="processId" type="hidden"/>
	<div class="layui-form-item">
		<label class="layui-form-label">流程</label>
		<div class="layui-input-block">
			<select id="process" name="process">
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">参数名称</label>
		<div class="layui-input-block">
			<input id="parameterName" name="parameterName" type="text" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">参数类型</label>
		<div class="layui-input-block">
			<select id="typeName" name="typeName">
				<option value="0">字符串</option>
				<option value="1">整数型</option>
				<option value="2">小数型</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">缺省值</label>
		<div class="layui-input-block">
			<input id="value" name="value" type="text" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">参与展示</label>
		<div class="layui-input-block">
			<select id="isShow" name="isShow">
				<option value="0">是</option>
				<option value="1">否</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">参与判断</label>
		<div class="layui-input-block">
			<select id="isJudge" name="isJudge">
				<option value="0">是</option>
				<option value="1">否</option>
			</select>
		</div>
	</div>
</div>
</body>
<script src="<%=context %>/gooflow/jquery.min.js"></script>
<script src="<%=context %>/Source/lib/layui/layui.js"></script>

<script type="text/javascript">
var path = "<%=context %>";
    var _path = path+"/flow/processParameter";
    var processList = ${processList};
    var process = ${process};
    $(function () {
		//初始化流程
		$("#process").empty();
		$("#process").append('<option value="">--请选择--</option>');
		$.each(processList,function(index,obj){
			$("#process").append('<option value="'+obj.processKey+'">'+obj.processName+'</option>');
		});
		
		//赋值
		if(process){
			$("#processId").val(process.id);
			$("#process").val(process.processId);
			$("#parameterName").val(process.parameterName);
			$("#typeName").val(process.typeName);
			$("#value").val(process.value);
			$("#isShow").val(process.isShow);
			$("#isJudge").val(process.isJudge);
      }

    });

    //删除ligerComboBox事件重新绑定
    function appChange(){
      $('#entityName').unbind("ligerComboBox");
      $("#entityId").val("");
      $("#entityName").val("");
      $("#entityName").ligerComboBox({
                url: _entity_path + '/getComboBoxData?appId=' + tmp_app_id,
                valueField: 'id',
                textField: 'entityName',
                valueFieldID: 'entityId',
                selectBoxWidth: 180,
                selectBoxHeight: 240,
                width: 180,
                cancelable: false,
                renderItem: function (e) {
                  var data = e.data;
                  var out = [];
                  out.push('<div>' + data.entityName + '</div>');
                  return out.join('');
                }
              }
      );
    }
    
    function getData(){
        var data = {
        		"id":$("#processId").val(),
    			"processId":$("#process").val(),
    			"parameterName":$("#parameterName").val(),
    			"typeName":$("#typeName").val(),
    			"value":$("#value").val(),
    			"isShow":$("#isShow").val(),
    			"isJudge":$("#isJudge").val()
        };
        return JSON.stringify(data)
    }

	var form;
	layui.use('form', function(){
		form = layui.form;
		form.render('select');
	});

  </script>
</html>
